package com.itcast.plane.modoule.path.controller;

import com.itcast.plane.modoule.company.domain.Company;
import com.itcast.plane.modoule.path.domain.Path;
import com.itcast.plane.modoule.path.dto.PathCreatDTO;
import com.itcast.plane.modoule.path.service.PathService;
import com.itcast.plane.util.JsonResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/path")
public class PathController {

    @Resource
    private PathService pathService;

    @PostMapping("/add")
    public JsonResult addPath(@RequestBody PathCreatDTO creatDTO){
        return pathService.addPath(creatDTO);
    }

    @DeleteMapping("/delete/{id}")
    public JsonResult deletePath(@PathVariable int id){
        return pathService.deletePath(id);
    }

    @PutMapping("/edit")
    public JsonResult editPath(@RequestBody Path path){
        return pathService.editPath(path);
    }

    @GetMapping("/getpage")
    public JsonResult getPage(@RequestParam int pages){
        return pathService.getPage(pages);
    }

    @GetMapping("/getall")
    public JsonResult getAll(){
        return pathService.getAll();
    }
}
